<template>
	<div class="btn-group">

		<button class="btn btn-xs btn-info" @click="edit">
			<i class="ace-icon fa fa-pencil bigger-120"></i>
		</button>
			
		<button class="btn btn-xs btn-danger" @click="del">
			<i class="ace-icon fa fa-trash-o bigger-120"></i>
		</button>

	</div>
</template>

<script>
export default{
	name: 'operation',
	props: {
		section: Object
	},
	methods: {
		edit() {
				this.$parent.section = $.extend({}, this.section)
				$('#save-modal').modal('show')
		},
		del() {
			this.$confirm({title: ' ', content: '确定删除小节: ' + this.section.title + '?'})
				.then(() => {
					let url = process.env.VUE_APP_SERVER + 'business/admin/section/delete/' + this.section.id
					this.$axios.delete(url)
						.then(res => {
							if(res.data.status === 1) {
								this.$toast('已删除小节:' + this.section.title, this.$global.toast.success)
								this.$parent.list(1)
							}else {
								this.$toast(res.data.msg, this.$global.toast.fail)
							}
						})
				})
				.catch(() => {})
		}
	}
}
</script>

<style>
</style>
